<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2014.07.11.
   家居公司发布留言($$)*/

!defined('Q_PATH') && exit;

class Addguestbook_C_Controller extends InitController{

	public function index(){
		$arrJiajucompany=$this->_oParent->_arrJiajucompany;
		
		// 提交留言
		if($this->isPost()){
			$oGuestbook=new JiajucompanyguestbookModel();
			
			// 站点属性
			$oGuestbook->site_id=$arrJiajucompany['site_id'];
			$oGuestbook->jiajucompany_id=$arrJiajucompany['jiajucompany_id'];

			$oGuestbook->jiajucompanyguestbook_status=0;
			$oGuestbook->save();
			if($oGuestbook->isError()){
				$this->E($oGuestbook->getErrorMessage());
			}else{
				Jiaju_Credit::RUN($this->_oParent->_arrJiajucompany['jiajucompany_id'],$oGuestbook->jiajucompanyguestbook_id,$oGuestbook->create_dateline,1,0,'','jiajucompanyguestbook');
				
				$this->A($oGuestbook->toArray(),'留言提交成功，请等待审核通过！',1);
			}
		}

		Core_Extend::getSeo($this,array(
			'title'=>"{$arrJiajucompany['jiajucompany_fullname']}留言板",
			'keywords'=>"{$arrJiajucompany['jiajucompany_fullname']},留言板",
			'description'=>$GLOBALS['_option_']['site_name']."为您提供{$arrJiajucompany['jiajucompany_fullname']}在线留言服务，是您与{$arrJiajucompany['jiajucompany_fullname']}进行互动交流的最佳方式。",
		));
		
		$this->display(Jiaju_Extend::getTemplate($arrJiajucompany));
	}

}
